/*
 * @Author: 颜礼田 2564217790@qq.com
 * @Date: 2024-09-06 18:22:28
 * @LastEditors: 颜礼田 2564217790@qq.com
 * @LastEditTime: 2024-09-07 09:57:22
 * @FilePath: /webServer/src/filter/notfound.filter.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Catch, httpError, MidwayHttpError } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
import { useNotFoundError } from '../utils/resHelper';

@Catch(httpError.NotFoundError)
export class NotFoundFilter {
  async catch(err: MidwayHttpError, ctx: Context) {
    ctx.logger.warn(err);
    return useNotFoundError(err.message);
  }
}
